<?php
	$action = $_POST['act'];
	@$id = $_POST['id'];
	@$code = $_POST['code'];
	@$name = $_POST['name'];
	@$price = $_POST['price'];
	@$qty = $_POST['qty'];
	
	include_once('libs/shopping_cart.php');
	session_start();
	switch($action)
	{
		case 'add':
		$product = new product($id, $code, $name, $price);
		$_SESSION['CART']->add_product($product);
		break;
		case 'clr':
		$_SESSION['CART']->clear_cart();
		break;
		case 'del_product':
		$_SESSION['CART']->remove_product($id);
		break;
		case 'change_quantity':
		$_SESSION['CART']->update_product_qty($id, $qty);
		break;
	}
	
	echo $_SESSION['CART']->get_num_product();
?>